/**
 * @namespace Archetype.methodBuilders.eventSenders
 * Automatic event Sender for your component.<br>
 * It's a convenient way to send an event with arguments without using the event API.<br>
 *
 * The original method isn't called so Prototype.emptyfunction, it's alias _ , or any empty function
 * should do the trick for the definition<br>
 */
$N("Archetype.methodBuilders.eventSenders", {
	regexp:"^fire.*",
	/**
	 * Acts on the Archetype.Component definition method methodName (that matches "this.regexp")
	 *
	 * @param {Archetype.ComponentDefinition} component
	 * @param {Function} methodName
	 */
	build: function (component, methodName){
		//get event name
		var evtName=/^fire(.*)/.exec(methodName)[1];

		//Logger.log("["+component._private._definition[methodName].name+"]", "Registering event sender");
		
		//Archetype.Events.registerEventsPublisher(evtName, component._private);
		
		component._private._definition[methodName] = function(evtName, data){
			//data = data||"";
			Logger.log("Fire Event "+ evtName + " with data :" , data );
			//this.dispatchEvent(evtName, data, false);
			Archetype.engine.fire(evtName, data);
		}.bind(component._private, evtName);
		
	}
});